!function() {
    getApp();
    var t = require("../../../utils/http.js");
    const e = {
        src: "/subpages/static/images/gift.png",
        activeSrc: "/subpages/static/images/gifth.png",
        width: "100%",
        height: "100%"
    }, i = {
        src: "/subpages/static/images/gift1.png",
        width: "50%",
        top: "15%"
    }, s = {
        src: "/subpages/static/images/gift2.png",
        width: "50%",
        top: "15%"
    }, n = {
        src: "/subpages/static/images/gift3.png",
        width: "50%",
        top: "15%"
    }, a = {
        imgs: [ e, i ],
        fonts: [ {
            text: "积分",
            top: "140rpx"
        } ]
    }, o = {
        imgs: [ e, s ],
        fonts: [ {
            text: "优惠券",
            top: "140rpx"
        } ]
    }, r = {
        imgs: [ e, n ],
        fonts: [ {
            text: "再来一次",
            top: "140rpx"
        } ]
    };
    Page({
        data: {
            systemBarHeight: 20,
            navigationBarHeight: 40,
            degree: 2,
            tempPrizes:{},
            userPoint: 50,
            getPrizeTitle: "寄件优惠券",
            windowState: !1,
            prizeIndex: 0,
            ruleTxt: "",
            turning: !1,
            defaultStyle: {
                borderRadius: "15rpx",
                fontSize: "26rpx",
                fontColor: "#D6521A"
            },
            defaultConfig: {
                speed: 10
            },
            prizes: [ {
                x: 0,
                y: 0,
                ...a
            }, {
                x: 1,
                y: 0,
                ...o
            }, {
                x: 2,
                y: 0,
                ...a
            }, {
                x: 2,
                y: 1,
                ...r
            }, {
                x: 2,
                y: 2,
                ...o
            }, {
                x: 1,
                y: 2,
                ...r
            }, {
                x: 0,
                y: 2,
                ...a
            }, {
                x: 0,
                y: 1,
                ...o
            } ],
            activeStyle: {
                fontColor: "#ff5d5d",
                background: "/subpages/static/images/gifth.png"
            },
            buttons: [ {
                x: 1,
                y: 1,
                background: "#9c9dd8",
                fonts: [ {
                    text: "点击抽奖\n剩余次",
                    top: "25%"
                } ]
            } ]
        },
        start() {
            if (this.data.turning || this.data.degree < 1) return;
            this.setData({
                turning: !0
            });
            var _that = this;
            t.post("/app/sinvite/getSward", {}, !1, function(t){
                console.log('-------------t.s------------',t.s);
                if(t.s==0){
                    wx.showToast({ title:t.title, icon: "none" });
                }else{
                    t && _that.setData({
                        getPrizeTitle: t.title,
                        prizeIndex: t.key
                    });

                    const e = _that.selectComponent("#myLucky");
                    e.lucky.play(), setTimeout(() => {
                        var m = _that.data.prizeIndex;
                        e.lucky.stop(m), _that.setData({
                            degree: _that.data.degree - 1
                        });
                    }, 3e3);
                }
            });
        },
        end(t) {
            this.setData({
                windowState: !0,
                turning: !1
            });
            this.selectComponent("#myLucky").lucky.init();
        },
        closeHb() {
            this.setData({
                windowState: !1
            }), this.onLoad();
        },
        onLoad: function(e) {
            wx.getSystemInfo({
                success: t => {
                    this.system = t;
                }
            }), this.menu = wx.getMenuButtonBoundingClientRect(), this.systemBar = this.system.statusBarHeight, 
            this.navigationBar = 2 * (this.menu.top - this.system.statusBarHeight) + this.menu.height, 
            this.setData({
                systemBarHeight: this.systemBar,
                navigationBarHeight: this.navigationBar
            });
            var a = this;
            var tempPrizes = new Array();
            t.post("/app/sinvite/getSwardConfig", {}, !1, function(t) {
                console.log('a.data.prizes',a.data.prizes);
                console.log('-----t.lists------',t);
                t && (tempPrizes = a.data.prizes, t.lists.forEach(function(t, e, a) {
                    1 == t.type && (tempPrizes[e].imgs[1] = s), 2 == t.type && (tempPrizes[e].imgs[1] = i), 
                    3 == t.type && (tempPrizes[e].imgs[1] = n), tempPrizes[e].fonts[0].text = t.title;
                }), a.setData({
                    prizes: tempPrizes,
                    userPoint: t.user_point,
                    degree: t.match_num,
                    ruleTxt: t.rule
                }));
            });
        },
        onReady: function() {},
        onShow: function() {
            wx.getStorageSync("userId") || (wx.showToast({
                title: "请先登陆",
                icon: "none"
            }), setTimeout(function() {
                wx.redirectTo({
                    url: "/pages/login/login"
                });
            }, 2e3));
        },
        onHide: function() {},
        onUnload: function() {},
        onPullDownRefresh: function() {},
        onReachBottom: function() {},
        onShareAppMessage: function() {},
        closeme: function() {
            console.log(111), this.setData({
                windowState: !1
            });
        },
        toSign: function() {
            wx.switchTab({
                url: "/pages/gift/index/index"
            });
        }
    });
}();